#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLabel>
#include <QPixmap>
#include <QSpinBox>
#include <QTreeWidgetItem>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_actAddFolder_triggered();

    void on_actAddFiles_triggered();

    void on_treeFiles_3_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);

    void on_actDeleteItem_triggered();

    void on_actScanItems_triggered();

    void on_actZoomFitH_triggered();

    void on_actZoomFitW_triggered();

    void on_actZoomIn_triggered();

    void on_actZoomOut_triggered();

    void on_actZoomRealSize_triggered();

    void on_actDockFloat_triggered(bool checked);

    void on_actDockVisible_triggered(bool checked);

private:
    void BuildTreeHeader();

    void InitTree();

    void AddFolderItem(QTreeWidgetItem *parItem, QString dir);

    QString GetFinalFolderName(const QString &fullPathName );

    void AddImageItem(QTreeWidgetItem *parItem, QString fileName);

    void DeleteItem(QTreeWidgetItem *parItem, QTreeWidgetItem* item);

    void ChangeItemCaption(QTreeWidgetItem *item);

    void displayImage(QTreeWidgetItem* item);
private:
    Ui::MainWindow *ui;
    enum TreeItemType {itTopItem= 1001, itGroupItem, itImageItem};
    enum TreeColNum {colItem = 0, colItemType, colDate};
    QLabel *labFileName;
    QLabel *labNodeText;
    QSpinBox *spinRatio;
    QPixmap m_pixMap;
    float m_ratio = 1;
};
#endif // MAINWINDOW_H
